# encoding: utf-8
# Author    : limusen
# Datetime  : 2023/10/12 15:32
# File      : dex.py
# explain   : 文件说明
import time

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver


def get_captcha_image_data_url(locator):
    driver = webdriver.Chrome()
    driver.get('http://192.168.3.198:8081/login')
    time.sleep(3)
    driver.find_element(locator)

    # Wait for the element to be clickable
    # WebDriverWait(driver, 10).until(EC.element_to_be_clickable(locator))
    # captcha_image_base64 = driver.execute_script(
    #     "return arguments[0].toDataURL('image/png').substring(21);",
    #     element
    # )
    # return captcha_image_base64


info = (By.XPATH, '//*[@id="app"]/div/div/div/div/div/div/form/div[3]/div[2]/img')

res = get_captcha_image_data_url(info)
print(res)


